<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>1</div>
    <div id="one">2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
</body>
    <script src="js/jquery-3.7.1.js" type="text/javascript" charset="utf-8"></script>
    <script>
        //过滤出one额外添加属性
        //   $("div").css("background-color","green").filter("#one").css("border","5px solid blue") ;

        //包装集对象.filter(function(index){
        // 
        //})
        $("div").css("background","green").filter(function(index){
        return index==5 || $(this).attr("id")=="one" ;
    }).css("background","red") ;

    //设置奇数
    var subDiv = $("div").filter(function(index){
        return index % 2 ==0
    });
    subDiv.css('color','red');
    </script>
</html>